package com.example.checkgrouplist;

import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout.*;
	
public class CheckList extends Activity {
	final static int ACT_EDIT =0;
	ImageButton NewImage;
	TextView Name;
	TextView Date;
	TextView Time;
	TextView Alram;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //win = getWindow();
        setContentView(R.layout.activity_check_list);
        /*
        NewImage = (ImageButton)findViewById(R.id.List_image);
        Name = (TextView)findViewById(R.id.List_Name);
        Date = (TextView)findViewById(R.id.List_date);
        Time = (TextView)findViewById(R.id.List_time);
        Alram = (TextView)findViewById(R.id.List_alram);
        */
    }
    
   
    public void PlusNewGroup(View v)
    {
    	/*도저히 주위화면을 어둡게 해서 입력받는 방식을 구현할 수 가 없다... ㅠㅜㅠㅜ
    	LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    	RelativeLayout SubList = (RelativeLayout)inflater.inflate(R.layout.activity_sub_check_list,null);
    	RelativeLayout.LayoutParams paramlinear = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT , RelativeLayout.LayoutParams.FILL_PARENT);
    	win.addContentView(SubList,paramlinear);
    	*/
    	Intent intent = new Intent(this, Sub_Check_List.class);
    	//intent.putExtra("NewImage",NewImage.getDrawable().toString());
    	intent.putExtra("Name",Name.getText().toString());
    	intent.putExtra("Date", Date.getText().toString());
    	intent.putExtra("Time", Time.getText().toString());
    	intent.putExtra("Alram", Alram.getText().toString());
    	startActivityForResult(intent, ACT_EDIT);    	
    }
    
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
    	switch(requestCode)
    	{
    	case ACT_EDIT:
    		if(resultCode==RESULT_OK)
    		{
    			NewImage = (ImageButton)findViewById(R.id.List_image);
    	        Name = (TextView)findViewById(R.id.List_Name);
    	        Date = (TextView)findViewById(R.id.List_date);
    	        Time = (TextView)findViewById(R.id.List_time);
    	        Alram = (TextView)findViewById(R.id.List_alram);
    			LinearLayout InScrollView = (LinearLayout)findViewById(R.id.Group_Out_Layout);
    			//RelativeLayout NewCheckList = (RelativeLayout)findViewById(R.id.NewGroup_In_Layout);
    			LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    			RelativeLayout NewCheckList = (RelativeLayout)inflater.inflate(R.layout.add_new_checklist_mold, null);
    			//
    			//RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,Re;ative)
    			//NewImage.setImageDrawable((Drawable)(data.getStringExtra("NewImage"));
    			Name.setText(data.getStringExtra("NameOut"));
    			Date.setText(data.getStringExtra("DataOut"));
    			Time.setText(data.getStringExtra("TimeOut"));
    			Alram.setText(data.getStringExtra("AlramOut"));
    			InScrollView.addView(NewCheckList);
    			setContentView(InScrollView);
    			
    		}
    	}
    }


	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_check_list, menu);
        return true;
    }
}
